<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/krosExt.css" />
     <link rel="stylesheet" type="text/css" href="../css/list.css" />  
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <script type="text/javascript" charset="UTF-8" src="../script/jquery-1.11.3.min.js"></script>
      <script type="text/javascript" charset="UTF-8" src="../script/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="../script/artTemplate-plugin.js"></script>
    <script type="text/javascript" src="../script/api.js"></script>
     <script type="text/javascript" src="../script/config.js"></script>
    <script type="text/javascript" src="../script/main.js"></script>
    <script type="text/javascript" src="../script/aui-tab.js" ></script>
<script type="text/javascript" src="../script/aui-sharebox.js" ></script>
<script type="text/javascript" src="../script/swfobject.js"></script>
<script type="text/javascript" src="../script/web_socket.js"></script>
<!-- <script type="text/javascript" src="http://chat.mcooz.com/Applications/Chat/Web/js/jquery.min.js"></script> -->

<style>
#header ul li.active {
  display: block;
}
#header ul li {
  color: #fff;
  display: none;
  font-size: 18px;
  height: 40px;
  line-height: 40px;
  position: relative;
  text-align: center;
}
#header ul li.active {
  display: block;
}
    .blue{color:#ff7700;}
    .pdt20{padding-top: 20px;}
   #Home {
  background: #EEE;
}
.mgt20{
    margin-top: 20px;
}
.border-t, .border-b {
  position: relative;
}
#target{
     display: block;
}
#box li.active{display: block;}
#box li {display: none;}
/* .aui-iconfont {
  font-family: "aui_iconfont";
  font-size: 1.2rem;
  font-style: normal;
  position: relative;
  display: block;
  float: left;
} */

.aui-btn-info {
  background: none;
}
button, .aui-btn {
  background:#ff7700;
 
}
.aui-btn.aui-btn-info.aui-margin-r-8 {
  margin-left: 10px;
}
#tab{
  margin-top: 150px;
}
#live{
  margin-top: 10px;
}
.orange{
  color: #ff7700;
}
.aui-sharebox{
  opacity: 0.1
}
.gift{
  background-image: url('../image/gift.png');
  background-color: none;
  background-size:30px 30px;
  background-repeat: no-repeat;

  width: 50px;
  height: 30px
}
.gift_box{
  
margin-top: 7px;
margin-left: 7px;
  }
.speech_item{
  font-size: 16px;
}
</style>

<script type='text/html' id='cardTemplate'>
    <div class="chat-user-card-wrap   lv--0"><a class="card-close" href="javascript:close_card();" data-type="closecard">×</a>
        <div class="chat-user-card">
            <div class="user-card-main clearfix">
                <div class="user-card-widget-tl"></div>
                <div class="user-card-widget-br"></div>
                <div class="user-card-title">
                    <h1><%=username%></h1>
                    <strong class="user-card-badge">
                        <span>
                            <span class="user-level level-<%=grade_level%>  level-size1 level-bgpng   lve-icon-1to9  "></span>
                        </span>
                    </strong>
                </div>
            </div>
            <div class="user-card-action">
                <div class="user-card-action-inr">
<a class="action-item" data-type="toreport" clt="0" rel="142774332" gid="1" chatid="191f9511c367477e771e050000000000" nickname="dogegg123">举报用户</a>
 

                           <a class="action-item" data-type="shield" href="javascript:;" rel="0"><i class="icon pb-icon"></i>屏蔽用户</a>


<%if (role==2&&is_gag==0){%>
<%if (is_manager==1){%>

            <a class="action-item" data-type="appoint" href="javascript:appointment_management_cancel(<%=uid%>,1,'<%=username%>','<%=act_username%>');" >解除房管</a>
 <%} else {%>
                            <a class="action-item" data-type="appoint" href="javascript:appointment_management(<%=uid%>,1,'<%=username%>','<%=act_username%>');" >任命房管</a>
 <%}%>
 <%}%>
<%if (is_gag==0&&host==0){%>
<%if ((role==1||role==2)&&role!=3&&is_manager==0){%>
                            <a class="action-item" data-type="mute" href="javascript:gag_t(<%=uid%>,1,'<%=username%>','<%=act_username%>')">禁止发言</a>
 <%}%>
<%}%>
<%if (is_gag==1){%>
<%if ((role==1||role==2)&&role!=3){%>
                            <a class="action-item" data-type="mute" href="javascript:gag_t_cancel(<%=uid%>,1,'<%=username%>','<%=act_username%>')">解除禁言</a>
 <%}%>
<%}%>


                    <a class="action-item" data-type="sendletter" href="/member/pm" rel="142774332" target="_blank">
                        <span>发站内信</span>
                    </a>
                </div>
            </div>
        </div>
    </div>
</script> 


 <script type='text/html' id='deliveInfoTemplate1'>
                              <div class="aui-col-xs-6 kros_overfollow">
                    <div class="kros_overfollow">
                        <a id="kros_a" onclick="gootroom(<%=uid%>);"  ><img class="kros_img  " src="http://www.mcooz.com/upload/images/<%=uid%>.jpg" alt=""></a>
                    </div>
                    <div class="row clearfix">
                        <div class="aui-col-xs-12 column left ">
                            <div class="caption"><%=nicheng%>  ： <%=title%></div>
                            
                        </div>
                       
                    </div>
                </div>
            </script>
             <script type='text/html' id='noDataTemplate'>
            <div class="pro_list border-bottom" style="text-align:center;line-height:150px">当前暂无数据
            </div>
            </script> 

               <script type='text/html' id='chartsTemplate_10'>
            <div class="aui-list-item aui-list-item-middle">
                <div class="aui-media-list-item-inner">
                <div style="width: 3rem;" >
               <%if (chartsId==1){%>
                <strong class="orange">No.<%=chartsId%></strong>
 <%} else {%>
                No.<%=chartsId%>

<%}%>
                </div>
                    <div class="aui-list-item-media" style="width: 3rem;">
                        <img  src="<%=portrait%>" class="aui-img-round aui-list-img-sm">
                    </div>
                    <div class="aui-list-item-inner ">
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-14"><%=nicheng%></div>
                            <div class="aui-list-item-right"></div>
                        </div>
                        <div class="aui-list-item-text">
                                 <span class="l-icon cuserlevel level-<%=grade_level%> level-bgpng  level-size1" data-uid="299704"  selector="user-level"></span>
                        </div>
                    </div>
                </div>
            </div>
        </script>  


                    <script type='text/html' id='loadingTemplate'>
<div id="loading">
<i class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>
<span class="sr-only">Loading...</span>

</div>
</script> 

<script type='text/html' id='anchorTemplate'>
<div class="aui-list-item-media" style="width:3rem;">
                        <img src="<%=portrait%>" class="aui-img-round" >
                    </div>
                    <div class="aui-col-xs-8">
                    <div class="">
                        <div class="aui-list-item-text text-white aui-font-size-18 aui-ellipsis-1"><%=title%></div>
                        <div class="aui-list-item-text text-white">
                           <div><%=username%></div>
                        </div>
                         <div class="aui-list-item-text text-white">
                         <div class="aui-font-size-12">体重:<%=gains%>kg 分类:<span class="aui-text-primary"><%=cate_name%></span></div>
                        </div>
                    </div>
                    </div>
                    <div class="aui-col-xs-2">
                        <div class="">
                        <div class="aui-btn" style="border-radius:30px;height:22px;line-height:22px;color:#fff">关注</div>
                        <div class="aui-list-item-text text-white">
                           <div style="padding-left:5px"><%=collect_sum%></div>
                        </div>
                    </div>
                     </div>
</script> 
</head>

<body>
<div class="chat-user-card-holder" style="display:none" id='chat-user-card-holder'>

</div>
<div data-role="page"   class="content">
  <div data-role="header" id="header" class="kros_header" data-position="fixed">
        <a href="#kros_panel" id="back" data-rel="back" class="ui-btn-left ui-btn-corner-all ui-btn ui-icon-home ui-btn-icon-notext ui-shadow" style="color:#fff;">Back</a>
        <a href="#" onclick="goToPage('search.html');" id="search" data-ajax="false" class="ui-btn ui-btn-letf  ui-btn-corner-all ui-btn-icon-notext  ui-icon-search ui-shadow" style="color:#fff;">风之伤</a>
        <ul>
            <li class="border-b active" ></li>
           
            </ul>
        </div>

<div role="main" id="target"  style="background:#f2f2f2;">
    <div class="aui-tab" id="tab" >
        <div class="aui-tab-item aui-active">聊天</div>
        <div class="aui-tab-item"><div></div>主播</div>
        <div class="aui-tab-item">排行榜</div>
        <div class="aui-tab-item">直播</div>
    </div>
<div id="box" >
    <li  class="active"> <div class="caption" id="dialog" style="height:200px;overflow:scroll; overflow-x:hidden;"></div></li>
    <li >
    <div class="aui-list aui-media-list aui-list-noborder ">
            <div class="aui-list-item aui-list-item-middle">
                <div class="aui-media-list-item-inner " id="anchor">
                    
                </div>
            </div>
        </div>
        </li>
    <li >  <div class="aui-bar aui-bar-btn aui-bar-btn-sm" style="width:80%;margin-top:10px">
        <div class="aui-bar-btn-item aui-active">贡献日榜</div>
        <div class="aui-bar-btn-item">贡献周榜</div>
        <div class="aui-bar-btn-item">贡献总榜</div>
    </div>
<div id="charts" style="height:200px;overflow:scroll; overflow-x:hidden;">
     <ul class="aui-list aui-media-list" id="krosrow1">
       
    
       
            <div id="charts_10">
              
             </div>
        </ul>
</div>
    </li>
    <li >  <div data-demo-html="true" class="" id ="live" style="height:200px;overflow:scroll; overflow-x:hidden;">
            <ul data-role="listview" id="listview" data-inset="true" data-corners="false">
         
       
             
            </ul>
        </div></li>

    </div>
</div> 

   <footer class="aui-bar aui-bar-tab" id="footer">
          <li class="aui-list-item" >
                <div class="aui-list-item-inner">
                 <div class="aui-col-xs-9" style="margin-top:5px;border:1px solid #ddd;height:35px;margin-left:8px;border-radius:10px">
                    <div class="aui-list-item-input aui-margin-l-1" style="margin-left:8px;" >
                    <div class="aui-col-xs-6" >
                        <input id="input"  type="text" style="height:30px" placeholder="请输入弹幕..">
                    </div>
                    </div>
                    <div style="float:right;">
                      <div class="aui-col-xs-2" style="border-left:1px solid ;width:10px;height:25px;float:left;margin-top:4px">
                    </div>
                    <div style="float:left;">
                    <div class="aui-col-xs-8" >
                    <i class="aui-iconfont aui-icon-paper" id="submit" style="font-size:22px;vertical-align:middle;text-align:center;margin-right:8px;margin-top:7px" onclick="onSubmit('s/','1');"></i>
                    </div>
                  </div>
                    </div>
                    </div>
                     <div style="float:left" class="gift_box">
                    <div class="aui-margin-r-8  gift" id="gift" onclick="openSharebox()"></div>
                  </div>
                </div>
            </li>
    </footer>
    </div>

   

</body>
</html>
<script>
var uid,username,roomId
  userArr= $api.getStorage('userArr');

  if (userArr) {
  uid=userArr.user_id;
  username=userArr.username;
}else{
  uid=''
  username=''
};
apiready = function(){
 roomId=api.pageParam.id;

 api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
  api.closeWin()
    });

init()
charts()
anchor()
   if (typeof console == "undefined") {    this.console = { log: function (msg) {  } };}
            WEB_SOCKET_SWF_LOCATION = "http://chat.mcooz.com/Applications/Chat/Web/swf/WebSocketMain.swf";
            WEB_SOCKET_DEBUG = true;
            var ws, identity,kros_id=0,kros_name,name,agent,shipStop=1,timer=new Array(),renwu=new Array(),open_=new Array(),form_ID,playerWidth_,chatWidth,shipCount=1,openStatus=0, client_list={};


    connect();



var winWidth = api.winWidth;
var winHeight = api.winHeight;

 api.parseTapmode();
$(".content").css({ width:winWidth,height:winHeight});
var header = $api.byId('header');
$api.fixStatusBar(header);
var  top=$api.dom('.border-b').offsetTop+3;
$("#back,#search").css({ top:top});
var  height=$api.dom('#header').offsetHeight+3;
$("#target").css({ marginTop:top-3});
var  top_=$api.dom('#input').offsetTop+7;
$("#gift").css({ top:top_});
//$("#tab").css({ top:'100px'});
var  top_dialog=$api.dom('#dialog').offsetTop;
var  top_footer=$api.dom('#footer').offsetTop;

dialog_height=top_footer-top_dialog

$("#dialog,#live").css({ height:dialog_height});
var  top_tab=$api.dom('#tab').offsetTop;
var  height_tab=$api.dom('#tab').offsetHeight;
charts_height=top_footer-top_dialog-height_tab;

// alert(top_tab)

$("#charts").css({ height:charts_height});


api.openFrame({
        name: 'player',
        url: 'player.html',
        rect: {
                x:0,
                y:0,
                w:winWidth,
                h:240
        },
          pageParam: {
                                  roomId: roomId
                                  },
       // bgColor: 'rgba(51,51,51,0)'
    });

// var obj = api.require('playModule');
// obj.play({
//     rect:
//     {    x: 0,
//         y : 0,
//         w : winWidth,
//         h: 240
//     },
//     fixedOn: api.frameName,
//     title: 'test',
//     url: 'http://7907.liveplay.myqcloud.com/live/7907_4e6b864b35dc11e791eae435c87f075e.m3u8 ',
//     defaultBtn : false,
//     enableFull : false,
//      isTopView : false
// }, function(ret, err) {

// });


// api.openFrame({
//         name: 'button',
//         url: 'button.html',
//         rect: {
//                 x:0,
//                 y:20,
//                 w:'auto',
//                 h:'auto'
//         },
//        // bgColor: 'rgba(51,51,51,0)'
//     });




 var tab = new auiTab({
        element:document.getElementById("tab"),
    },function(ret){
      // alert(JSON.stringify(ret))
        xshowShow(ret.index-1)
    });

 var bar = document.querySelectorAll(".aui-bar-btn");
    if(bar){
        for(var i=0; i<bar.length;i++){
            var d = bar[i];
            var tab = new auiTab({
                element:bar[i],
                repeatClick:true
            },function(ret){
                if(ret.dom.parentNode.getAttribute("type") && ret.dom.parentNode.getAttribute("type")=="count"){
                    var count = parseInt(document.getElementById("count").value);
                    if(ret.index==2)return;
                    if(ret.index==1){
                        document.getElementById("count").value = count-1;
                    }
                    if(ret.index==3){
                        document.getElementById("count").value = count+1;
                    }
                }
            });

        }
    }
}

   
function xshowShow(id) {
            eHeaderLis = $api.domAll('#box li');
              for(i = 0;i <= eHeaderLis.length;i++) {
                    if(i == id){
               $api.addCls( eHeaderLis[i], 'active');
                    continue;
                    }try {
                    $api.removeCls(eHeaderLis[i], 'active');

                    }catch(e){
                    return true;
                    }
                    }
}





    function connect() {
       ws = new WebSocket("ws://www.xian08.com:7272");
       ws.onopen = onopen;
       ws.onmessage = onmessage; 
       ws.onclose = function() {
          console.log("连接关闭，定时重连");
          connect();
       };
       ws.onerror = function() {
          console.log("出现错误");
       };
    }


 function onopen(){

        name=username
        uid=uid;
        item_id=roomId;
         var login_data = '{"type":"login","client_name":"'+name.replace(/"/g, '\\"')+'","room_id":"'+roomId+'","agent":"mobile","uid":"'+uid+'","item_id":"'+item_id+'"}';
        console.log("握手成功，发送登录数据:"+login_data);
        ws.send(login_data);
    }


    function onmessage(e)
    {
       //alert(e.data)
        var data = eval("("+e.data+")");
        switch(data['type']){
            case 'ping':
                ws.send('{"type":"pong"}');
                break;;
            case 'login':
                
                // $("#num-v").html(data['online']+1);
                
                 var str = ' 进入了直播间';
               
                    
               if(data['client_name']==''){
              say_login(data['client_id'], data['client_name'],  data['client_name'], data['time'],  data['agent']);
                }
                else{
                say_login(data['client_id'], data['client_name'],  data['client_name']+str, data['time'],  data['agent'],  data['grade_level'],  data['is_host'],data['is_manager']);
                }
                kros_id=data['client_id'];
                kros_name=data['client_name'];

                if(data['client_list'])
                {
                    client_list = data['client_list'];
                }
                else
                {
                    client_list[data['client_id']] = data['client_name']; 
                }
                console.log(data['client_name']+"登录成功");
                break;
            // 发言
            case 'say':
    

    say(data['from_client_id'], data['from_client_name'], data['content'], data['time'], data['agent'],data['ship'],data['shipCount'],data['grade_level'],data['is_manager'],data['is_host']);


            from_ID=data['from_client_id'];
            
            if(data['content']=="huojian")  {
                                                // sdfdsfdfs();
                                             }

            if(data['content']=="Atlantis") {
                                                // Atlantis();
                                            }     



          if(data['ship']==1){
          
          
                                    
                 } 

 
        if(data['changeShip']){



                                }
                          
                           
               
                               
                                   
            

                break;
            // 用户退出 更新用户列表
            case 'logout':
                delete client_list[data['from_client_id']];
        }
    }


 function say_login(from_client_id, from_client_name, content, time,agent,grade_level,is_host,is_manager){
      content=removeHTMLTag(content);
      
      var agentHtml;
        name=username
     
      if(name!=''){
          
      if( agent=='mobile'){
          
    agentHtml='<i class="fa fa-mobile fa-1x" aria-hidden="true" style="color:#428bca"></i>'
          
      }else{
      
      
      agentHtml='<i class="fa fa-desktop fa-1x" aria-hidden="true" style="color:#428bca"></i>'
                    }
          
      }
      else{
      
      agentHtml='';
      
        }
       b=is_manager;
        if(b==1){
        identity='房管'
        } else if(is_host==1 ){
         identity='主播'
        }
        
        else{
        identity=''
        }
       code_="<a  id='"+from_client_name+ "' href='javascript:info(\""+from_client_name+ "\")' >";
        if(name!=''){
        level=' <span class="l-icon cuserlevel level-'+grade_level+' level-bgpng  level-size1_" ></span>'
        
        $("#dialog").append('<div class="speech_item">'+agentHtml+'<span  class="identity">'+identity+'</span> '+level+code_+content+'</a>'+' </div>');
        }
      }



       // 发言
    function say(from_client_id, from_client_name, content, time, agent,ship,shipCount,grade_level,is_manager,is_host){
                content=removeHTMLTag(content);
                    //var agent ="<{$agent}>";
                if(content=='Atlantis1'){
                   return;
                }     
                if( agent=='mobile'){
                agentHtml='<i class="fa fa-mobile fa-1x cuserlevel " aria-hidden="true" style="color:#428bca"></i>'
                }else{
                agentHtml='<i class="fa fa-desktop fa-1x cuserlevel" aria-hidden="true" style="color:#428bca"></i>'
                }
               b=is_manager;
                  if(b==1){
                  identity='房管'
                }  else if(is_host==1){
                identity='主播'
                
                }
                
                else{
                identity=''
                }
                 if (content.indexOf("禁言") > 0) {
                    var html='<div class="speech_item warning">系统提示:'+content+' </div>';

                 
                    } else if(content.indexOf("主播") > 0){
                    var html='<div class="speech_item warning">系统提示:'+content+' </div>';
                    }
                    
                    else if(ship==1){
                     content=$.parseJSON(content); 
                  // alert(content)
                  if(content.status==1){
                      
                      var html='<div class="speech_item ">'+content.message+' </div>';
                  }else{
                  
                      
                      
                   
                   
                    
                    var html='<div class="speech_item warning">系统提示:'+content.message+' </div>';}
                    }
                    
                    else{
                    
                    
                code_="<a  style='color:#757575' id='"+from_client_name+ "' href='javascript:info(\""+from_client_name+ "\")' >";
                level=' <span class="l-icon cuserlevel level-'+grade_level+' level-bgpng  level-size1_" ></span>'
                var html='<div class="speech_item">'+agentHtml+'<span  class="identity">'+identity+'</span>'+level+code_+from_client_name+'</a><span class="spa">:</span>'+content+' </div>'
                }
                document.getElementById("dialog").innerHTML += html;
                document.getElementById("dialog").scrollTop = document.getElementById("dialog").scrollHeight;   
                
                var shipGiftWidth=parseInt($("#s_sh_"+from_client_name).width())
                var o = document.getElementById("#s_sh_"+from_client_name);
                if(ship==1){
                
                
                
             
                    
                   
                }

    }


         function removeHTMLTag(str){
                str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
                str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
                //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
                str=str.replace(/&nbsp;/ig,'');//去掉&nbsp;
                return str;
            }


             // 提交对话
    function onSubmit(urlVal,item_id) {  
      var input = document.getElementById("input");
        var to_client_id = "all";
         var to_client_name ="all";
          if(uid==''){
                    // art.dialog.open(urlVal, {
                    // title: '登录',
                    // });  
               extAlert('您尚未登录','bottom'); 
                    }
                else{
            
            ws.send('{"type":"say","uname":"'+username+'","level":"1","to_client_id":"'+to_client_id+'","to_client_name":"'+to_client_name+'","content":"'+input.value.replace(/"/g, '\\"').replace(/\n/g,'\\n').replace(/\r/g, '\\r')+'","uid":"'+uid+'","item_id":"'+roomId+'"}');
            }  
            input.value = "";
            $('#input').blur();
            }


    function info(from_client_name){
            var top = $("#dialog").offset().top+80;
            var left=parseInt($("#dialog").offset().left)+40;
                        var url = 'http://www.mcooz.com/index/get_card';
                $.getJSON(url,{'username':from_client_name,'uid':uid,'item_id':'1'},function(json){
                var Html = template.render('cardTemplate',json);
                $('#chat-user-card-holder').empty().append( Html);
                 });  
            $('#chat-user-card-holder').css({'display':'block','left':left,'top':top});
    }


    function close_card(){
    
        $('#chat-user-card-holder').css({'display':'none'});
    
                    }

    function gag_t(uid,item_id,username,act_username){
             var url = convertUrl(__siteUrl__,'index/gag_act');
             
                $.getJSON(url,{'uid':uid,'item_id':item_id},function(json){
                    
                ws.send('{"type":"say","to_client_id":"all","to_client_name":"a","content":"'+username+'被房管'+act_username+'禁言"}');
                close_card()
                 }); 

        }

   
        function gag_t_cancel(uid,item_id,username,act_username){
            var url = convertUrl(__siteUrl__,'index/gag_act_cancel');
            $.getJSON(url,{'uid':uid,'item_id':item_id},function(json){
      ws.send('{"type":"say","to_client_id":"all","to_client_name":"a","content":"'+username+'被房管'+act_username+'解除禁言"}');
                close_card()
                 }); 

        }


          function appointment_management(uid,item_id,username,act_username){
             // var url = '<{:U('index/appointment_management_act')}>';
            var url = convertUrl(__siteUrl__,'index/appointment_management_act');
             
                $.getJSON(url,{'uid':uid,'item_id':item_id},function(json){
                    
                    if(json.ext==0){
                        alert('他尚未关注,无法任命!');
                    } else if(json.ext==1&&json.status==1){
                    
                    
                ws.send('{"type":"say","to_client_id":"all","to_client_name":"a","content":"'+username+'被主播'+act_username+'任命为房管"}');
                } else{
                alert(json.message)
                        }
             
                close_card()
                 }); 

        }
        
           function appointment_management_cancel(uid,item_id,username,act_username){
             // var url = '<{:U('index/appointment_management_act_cancel')}>';
       var url = convertUrl(__siteUrl__,'index/appointment_management_act_cancel');
             
                $.getJSON(url,{'uid':uid,'item_id':item_id},function(json){
                    
                ws.send('{"type":"say","to_client_id":"all","to_client_name":"a","content":"'+username+'被主播'+act_username+'解除房管"}');
                close_card()
                 }); 

        }

        function init(){


     var url = 'http://www.mcooz.com/index/recommend';

           api.ajax({
            url: url,
            method: 'get',
            data: {
                values: {
                    ling: 1
                }
            }
        }, function(json, err) {
// jso=JSON.stringify(json);
//           alert(json.status);


        var json2=json

 if(json2){
    $('#listview').empty();
            for(var item in json2)
        {
          // alert(item)
            //
            //console.log(1);

            //console.log(item);

            var deliveRowHtml1 = template.render('deliveInfoTemplate1',json2[item]);
            $('#listview').append(deliveRowHtml1);


        }
           }   else{

                                            var chartsHtml = template.render('noDataTemplate',1);
                                                $('#listview').empty().append(chartsHtml);
                                    }


        });
}


   function anchor(){


     var url = 'http://www.mcooz.com/index/krosList_json';

           api.ajax({
            url: url,
            method: 'get',
            data: {
                values: {
                    id: roomId
                }
            }
        }, function(json, err) {
// jso=JSON.stringify(json);
//           alert(json.status);
 if(json){
   
          // alert(item)
            //
            //console.log(1);

            //console.log(item);
             json.portrait=__portraitImagePath__+json.portrait
            var RowHtml= template.render('anchorTemplate',json);
            $('#anchor').append(RowHtml);


    
           }   else{

                                    }


        });
}



function  charts(){
             var loadingHtml = template.render('loadingTemplate',1);
            $('#krosrow1').append(loadingHtml);

            url = 'http://www.mcooz.com/index/charts';

      

               api.ajax({
            url: url,
            method: 'get',
            data: {
                values: {
                    chartsId: 1,
                    type:2,
                    to_id:roomId
                }
            }
        }, function(json, err) {

          $('#loading').remove();

                 if(json==null){
                                    
                                    }
                                    else{
                                             for(var item in json)
                                                 {
                                               //alert(json[item])
                                               json[item].portrait=__portraitImagePath__+json[item].portrait
                                                var chartsHtml = template.render('chartsTemplate_10',json[item]);
                                                $('#charts_10').append(chartsHtml);

                                                }
                                    }

                  });



                  
        }

 function add_lis(){
    api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
        var jsfun = 'unfull_act();';
        api.execScript({
            frameName: 'player',
            script: jsfun
        });
    });

 }

 function remove_lis(){

//   api.removeEventListener({
//     name: 'keyback'
// });

  api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
  api.closeWin()
    });

 }


    var sharebox = new auiSharebox();
    function openSharebox(){
        sharebox.init({
            frameBounces:true,//当前页面是否弹动，（主要针对安卓端）
            buttons:[{
                image:'../image/super_rocket.png',
                text:'超级火箭',
                value:'wx'//可选
            },{
                image:'../image/rocket.png',
                text:'火箭',
                value:'wx-circle'
            },{
                image:'../image/plane.png',
                text:'飞机',
                value:'qq'
            },{
                image:'../image/girl.png',
                text:'么么哒',
                value:'qq-qzone'
            },{
                image:'../image/chicken.png',
                text:'弱鸡'
            },{
                image:'../image/fabulous.png',
                text:'赞'
            },{
                image:'../image/ball.png',
                text:'虾球'
            },],
            col:4,
            // cancelTitle:'关闭'//可选,当然也可以采用下面的方式使用图标
            // cancelTitle:'<i class="aui-iconfont aui-icon-close aui-font-size-16"></i>'//可选
        },function(ret){
            if(ret){

              ship(ret.buttonIndex);
            }
        })
    }

     function ship(gift_id){
           if(uid==''){
             extAlert('您尚未登录','bottom'); 
                }
              else{  
                var input ="送出了一个轮船!";
                var ship=1
                var to_client_name='All'
                ws.send('{"type":"say","ship":1,"uid":"'+uid+'","to_id":"'+roomId+'","gift_id":"'+gift_id+'","shipCount":1,"to_client_id":"all","to_client_name":"'+to_client_name+'","content":"'+input.replace(/"/g, '\\"').replace(/\n/g,'\\n').replace(/\r/g, '\\r')+'"}');
            }
        }


        function  gootroom(id){

           api.execScript({
            frameName: 'player',
            script: "_playUrl("+id+")",
        });
        }
</script>



